//
//  CZMainTabber.swift
//  weibo008
//
//  Created by 大米 on 16/2/28.
//  Copyright © 2016年 大米. All rights reserved.
//

import UIKit

//定义协议
@objc protocol CZMainTabBarDelegate:NSObjectProtocol{
    optional
    func mainTabBarComposeClick()
}

class CZMainTabber: UITabBar {
    
    weak var composeDeleGate: CZMainTabBarDelegate?
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let width = frame.width * 0.2
        composeButton.frame = CGRect(x: 0, y: 0, width: width + 5, height:frame.height)
        composeButton.center = CGPoint(x: frame.width * 0.5, y: frame.height * 0.5)
        
        
    }

    lazy var composeButton: UIButton = {
        let button = UIButton()
        
        
        
        button.setBackgroundImage(UIImage(named: "tabbar_compose_button"), forState: UIControlState.Normal)
        button.setBackgroundImage(UIImage(named: "tabbar_compose_button_highlighted"), forState: UIControlState.Highlighted)
        
        
        button.setImage(UIImage(named: "tabbar_compose_icon_add"), forState: UIControlState.Normal)
        button.setImage(UIImage(named: "tabbar_compose_icon_add_highlighted"), forState: UIControlState.Highlighted)
        
        self.addSubview(button)
        
        button.sizeToFit()
        
        return button
    }()
    
}
